package com.stu;

import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;

import java.io.File;
import java.util.Collection;

/**
 * @author MI
 * @ClassName FileRename.java
 * @createTime 2021年10月28日 19:13:00
 */
public class FileRename {
    public static void main(String[] args) {
        String path = "d:\\Desktop\\javafx\\JavaFX中文视频";
        Collection<File> files = FileUtils.listFiles(new File(path), null, true);
        files.stream().forEach(vo -> {
            System.out.println(vo.getAbsolutePath());
            String name = vo.getName();
            vo.renameTo(new File(path,
                    StringUtils.replaceEach(name, new String[]{"，", "。"}, new String[]{"", ""})));
        });
    }
}
